<template>
  <div class="login">
   <input type="text" v-model="username" placeholder="username" />
   <input type="password" v-model="password" placeholder="password" />
   <button v-on:click="login">登录</button>
  </div>
</template>

<script>


export default {
data(){
  return{
    username:"",
    password:""
  }
},
methods:{
  login(){
    this.$store.dispatch({
      type:"login",
     username:this.username,
     password:this.password
    }).then(({data})=>{
this.$router.push("/news")
    })
  }
}
}
</script>